package com.pai4j.remote.ugc;

import com.pai4j.common.bean.PAIPageResponseBeanUtil;
import com.pai4j.common.bean.PAIResponseBean;
import com.pai4j.domain.vo.request.community.CreateContributionCommentRequestVO;
import com.pai4j.domain.vo.response.community.ContributionCommentResponseVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 社区共建评论远程接口
 *
 * @author: CYM-pai
 * @date: 2025/07/30 12:00
 **/
@FeignClient(name = "pai4j-ugc-service", contextId = "communityContributionCommentClient")
public interface CommunityContributionCommentClient {

    /**
     * 创建评论
     *
     * @param createRequest 创建评论请求
     * @return 评论ID
     */
    @PostMapping("/ugc-service/community/contribution/comment/create")
    PAIResponseBean<Long> create(@RequestBody CreateContributionCommentRequestVO createRequest);

    /**
     * 删除评论
     *
     * @param commentId 评论ID
     * @param operator  操作人
     * @return 删除结果
     */
    @DeleteMapping("/ugc-service/community/contribution/comment/delete/{commentId}")
    PAIResponseBean<Boolean> delete(@PathVariable Long commentId, @RequestParam String operator);

    /**
     * 获取共建的评论列表
     *
     * @param contributionId 共建ID
     * @return 评论列表
     */
    @GetMapping("/ugc-service/community/contribution/comment/listByContribution/{contributionId}")
    PAIResponseBean<List<ContributionCommentResponseVO>> listByContribution(@PathVariable Long contributionId);

    /**
     * 分页查询评论列表
     *
     * @param pageNo         页码
     * @param pageSize       页大小
     * @param contributionId 共建ID（可选）
     * @param commenter      评论人（可选）
     * @return 分页评论列表
     */
    @GetMapping("/ugc-service/community/contribution/comment/list")
    PAIResponseBean<PAIPageResponseBeanUtil<List<ContributionCommentResponseVO>>> list(
            @RequestParam(value = "pageNo", required = false, defaultValue = "1") Integer pageNo,
            @RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize,
            @RequestParam(value = "contributionId", required = false) Long contributionId,
            @RequestParam(value = "commenter", required = false) String commenter);
}
